﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.ComponentModel;

namespace dodone
{
	/// <summary>
	/// Interaction logic for ToItem.xaml
	/// </summary>
	public partial class TodoItem : UserControl
	{
		public TodoItem()
		{
			InitializeComponent();		
		}

		public void Collapse()
		{
			RootGrid.IsEnabled = false;
			CollapsibleGrid.Visibility = Visibility.Collapsed;
		}

		public void Expand()
		{
			RootGrid.IsEnabled = true;
			CollapsibleGrid.Visibility = Visibility.Visible;
		}

		public static readonly DependencyProperty CompleteProperty =
			DependencyProperty.Register("Complete", typeof(bool),
			typeof(TodoItem));

		public bool Complete
		{
			get { return (bool)GetValue(CompleteProperty); }
			set { SetValue(CompleteProperty, value); }
		}

		public static DependencyProperty TitleProperty =
			DependencyProperty.Register("Title", typeof(string),
			typeof(TodoItem));

		public string Title
		{
			get { return (string)GetValue(TitleProperty); }
			set { SetValue(TitleProperty, value); }
		}

		public static readonly DependencyProperty NoteProperty =
			DependencyProperty.Register("Note", typeof(string),
			typeof(TodoItem));

		public string Note
		{
			get { return (string)GetValue(NoteProperty); }
			set { SetValue(NoteProperty, value); }
		}

		public static readonly DependencyProperty DueProperty =
			DependencyProperty.Register("Due", typeof(DateTime),
			typeof(TodoItem));

		public DateTime Due
		{
			get { return (DateTime)GetValue(DueProperty); }
			set { SetValue(DueProperty, value); }
		}

		private void UserControl_MouseDoubleClick(object sender, MouseButtonEventArgs e)
		{
			this.Expand();
		}
	}
}
